package com.hjm.project.channelBillQbProfit.channelBillQbProfit.controller;

import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.hjm.framework.aspectj.lang.annotation.Log;
import com.hjm.framework.aspectj.lang.enums.BusinessType;
import com.hjm.project.channelBillQbProfit.channelBillQbProfit.domain.ChannelBillQbProfit;
import com.hjm.project.channelBillQbProfit.channelBillQbProfit.service.IChannelBillQbProfitService;
import com.hjm.framework.web.controller.BaseController;
import com.hjm.framework.web.domain.AjaxResult;
import com.hjm.common.utils.poi.ExcelUtil;
import com.hjm.framework.web.page.TableDataInfo;

/**
 * 展业端管理分润明细对账文件Controller
 * 
 * @author maker-platform
 * @date 2021-01-27
 */
@Controller
@RequestMapping("/channelBillQbProfit/channelBillQbProfit")
public class ChannelBillQbProfitController extends BaseController
{
    private String prefix = "channelBillQbProfit/channelBillQbProfit";

    @Autowired
    private IChannelBillQbProfitService channelBillQbProfitService;

    @RequiresPermissions("channelBillQbProfit:channelBillQbProfit:view")
    @GetMapping()
    public String channelBillQbProfit()
    {
        return prefix + "/channelBillQbProfit";
    }

    /**
     * 查询展业端管理分润明细对账文件列表
     */
    @RequiresPermissions("channelBillQbProfit:channelBillQbProfit:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ChannelBillQbProfit channelBillQbProfit)
    {
        startPage();
        List<ChannelBillQbProfit> list = channelBillQbProfitService.selectChannelBillQbProfitList(channelBillQbProfit);
        return getDataTable(list);
    }

    /**
     * 查询展业端管理分润明细对账文件列表
     */
    @RequiresPermissions("channelBillQbProfit:channelBillQbProfit:list")
    @PostMapping("/listMap")
    @ResponseBody
    public TableDataInfo listMap(@RequestParam Map param)
    {
        startPage();
        List<Map> maps = channelBillQbProfitService.selectChannelBillQbProfitListMap(param);
        return getDataTable(maps);
    }

    /**
     * 导出展业端管理分润明细对账文件列表
     */
    @RequiresPermissions("channelBillQbProfit:channelBillQbProfit:export")
    @Log(title = "展业端管理分润明细对账文件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ChannelBillQbProfit channelBillQbProfit)
    {
        List<ChannelBillQbProfit> list = channelBillQbProfitService.selectChannelBillQbProfitList(channelBillQbProfit);
        ExcelUtil<ChannelBillQbProfit> util = new ExcelUtil<ChannelBillQbProfit>(ChannelBillQbProfit.class);
        return util.exportExcel(list, "channelBillQbProfit");
    }

    /**
     * 新增展业端管理分润明细对账文件
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存展业端管理分润明细对账文件
     */
    @RequiresPermissions("channelBillQbProfit:channelBillQbProfit:add")
    @Log(title = "展业端管理分润明细对账文件", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ChannelBillQbProfit channelBillQbProfit)
    {
        return toAjax(channelBillQbProfitService.insertChannelBillQbProfit(channelBillQbProfit));
    }

    /**
     * 修改展业端管理分润明细对账文件
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        ChannelBillQbProfit channelBillQbProfit = channelBillQbProfitService.selectChannelBillQbProfitById(id);
        mmap.put("channelBillQbProfit", channelBillQbProfit);
        return prefix + "/edit";
    }

    /**
     * 修改保存展业端管理分润明细对账文件
     */
    @RequiresPermissions("channelBillQbProfit:channelBillQbProfit:edit")
    @Log(title = "展业端管理分润明细对账文件", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ChannelBillQbProfit channelBillQbProfit)
    {
        return toAjax(channelBillQbProfitService.updateChannelBillQbProfit(channelBillQbProfit));
    }

    /**
     * 删除展业端管理分润明细对账文件
     */
    @RequiresPermissions("channelBillQbProfit:channelBillQbProfit:remove")
    @Log(title = "展业端管理分润明细对账文件", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(channelBillQbProfitService.deleteChannelBillQbProfitByIds(ids));
    }
}
